<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>新建公告</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
    <style>
        .page-tab{ margin-bottom: 10px; padding: 10px;}
    </style>
</head>

<body>
<div class="admin-main">
    <p class="page-tab">
       <span class="layui-breadcrumb" lay-separator="&gt;" style="visibility: visible;">
           <a href="notice.html">公告管理<span class="layui-box">&gt;</span></a><a><cite>新增公告</cite></a></span></p>

    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">公告标题：</label>
            <div class="layui-input-block" style="width: 60%;">
                <input type="text" name="projectname" required lay-verify="name" autocomplete="off" placeholder="请输入公告标题" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">分类</label>
            <div class="layui-input-block" style="width: 80%;" >
               <textarea class="layui-textarea" id="LAY_demo_editor" style="display: none">把编辑器的初始内容放在这textarea即可</textarea>
            </div>
        </div>


        <div class="layui-form-item" style="margin-top: 30px;">
            <div class="layui-input-block">
                <div>
                    <button class="layui-btn" lay-submit="" lay-filter="branch">确定</button>
                    <a  href="notice.html" class="layui-btn layui-btn-primary">返回</a>
                </div>


            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="plugins/layui/layui.js"></script>
<script>
    layui.use(['form', 'laydate','layedit'], function() {
        var form = layui.form(),
                layer = layui.layer,
                layedit = layui.layedit,
                laydate = layui.laydate;

        //创建一个编辑器
        var editIndex = layedit.build('LAY_demo_editor');
        //自定义验证规则
        form.verify({
            police: function(value) {
                if(value.length < 4) {
                    return '标题至少得4个字符啊';
                }
            },
        });

        //监听提交
        form.on('submit(branch)', function(data) {
            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            return false;
        });

    });
</script>
</body>

</html>